package com.epam.kozich.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "PERSON")
public class Person {

	private Long id;

	private String login;

	private String password;

	private boolean banned;
	private boolean reader;
	public Person() {
		this("guest", "guest");
	}

	public Person(String login, String password) {
		this.login = login;
		this.password = password;
		this.banned = false;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name="PERSON_ID")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column
	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	@Column
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column
	public boolean isBanned() {
		return banned;
	}

	public void setBanned(boolean banned) {
		this.banned = banned;
	}
	public String toString(){
		return id + " : " + login + " : " + password + " : " + banned;
	}
 
	public void setReader(boolean reader) {
		this.reader = reader;
	}
	@Column
	public boolean isReader() {
		return reader;
	}

}
